#include "sha.h"
#include <QtGui/QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	sha w2;
	w2.setWindowTitle("ShaB");
	w2.show();

	QWidget * w = new QWidget;
	QVBoxLayout * vbl = new QVBoxLayout;
	QLabel * lab = new QLabel;
	QPixmap pix ("qtdemo.ico");
	lab->setPixmap(pix);
	vbl->addWidget(lab);

	QSharedMemory sharedMemory("whatthefk");
	QBuffer buffer;
	buffer.open(QBuffer::ReadWrite);
	QDataStream out(&buffer);
	out << pix;
	int size = buffer.size();

	if (sharedMemory.create(size)) 
	{
		sharedMemory.lock();
		char *to = (char*)sharedMemory.data();
		const char *from = buffer.data().data();
		memcpy(to, from, qMin(sharedMemory.size(), size));
		sharedMemory.unlock();

	}


	w->setLayout(vbl);
	w->setWindowTitle("ShaA");
	w->show();
	return a.exec();
}
